﻿using System;
using System.Windows.Forms;
using KZ.Exception;
using KZ.Lottery.BLL;
using KZ.Lottery.Resources;
using KZ.Utilities;

namespace KZ.Lottery
{
    public partial class FrmDashboard : Form
    {
        public FrmDashboard()
        {
            InitializeComponent();
        }

        private void FrmDashboard_Load(object sender, EventArgs e)
        {
            LoadRevenue();
        }

        private void LoadRevenue()
        {
            try
            {
                txtLastRevenue.Text = Utility.CurrencyParse(RuleReportBLL.GetRuleReportForRevenue(DateTime.Today.AddDays(-1)), Global.Culture);
                txtRevenue.Text = Utility.CurrencyParse(RuleReportBLL.GetRuleReportForRevenue(null), Global.Culture);
            }
            catch (DataAccessException ex)
            {
                Global.SetMessage(lblMessage, ex.Message, false);
            }
            catch (System.Exception ex)
            {
                Log.LogEx("LoadRuleReport", ex);
                Global.SetMessage(lblMessage, KZ_Message.BLM_ERR_GENERAL, false);
            }
        }
    }
}